<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>${ user }'s kindle reader</title>
    <style type="text/css">
        body{
            font-size: 1.1em;
            margin:0 5px;
        }

        h1{
            font-size:4em;
            font-weight:bold;
        }

        h2 {
            font-size: 1.2em;
            font-weight: bold;
            margin:0;
        }
        a {
            color: inherit;
            text-decoration: inherit;
            cursor: default
        }
        a[href] {
            color: blue;
            text-decoration: underline;
            cursor: pointer
        }
        p{
            text-indent:1.5em;
            line-height:1.3em;
            margin-top:0;
            margin-bottom:0;
        }
        .italic {
            font-style: italic
        }
        .do_article_title{
            line-height:1.5em;
            page-break-before: always;
        }
        #cover{
            text-align:center;
        }
        #toc{
            page-break-before: always;
        }
        #content{
            margin-top:10px;
            page-break-after: always;
        }
    </style>
</head>
<body>
<div id="cover">
    <h1 id="title">${ user }'s kindle reader</h1>
    <a href="#content">Go straight to first item</a><br />
    ${ mobitime?datetime?string.short }
</div>
<div id="toc">
    <h2>Feeds:</h2>
    <ol>
        <#assign feed_count = 0 />
        <#list feeds as feed >
        <#if (feed.entryCount > 0) >
        <#assign feed_count = feed_count + 1 />
        <li>
            <a href="#sectionlist_${ feed_index }">${ feed['title'] }</a>
            <br />
            ${ feed.entryCount } items
        </li>
        </#if>
        </#list>
    </ol>

    <#list feeds as feed >
    <#if (feed.entryCount > 0) >
    <mbp:pagebreak />
    <div id="sectionlist_${ feed_index }" class="section">
        <#if (feed_index < feed_count - 1) >
        <a href="#sectionlist_${ feed_index+1 }">Next Feed</a> |
        </#if>

        <#if (feed_index > 0) >
        <a href="#sectionlist_${ feed_index-1 }">Previous Feed</a> |
        </#if>

        <a href="#toc">TOC</a> |
        ${ feed_index + 1 }/${ feed_count } |
        ${ feed.entryCount } items
        <br />
        <h3>${ feed['title'] }</h3>
        <ol>
            <#list feed['entries'] as item >
            <div id="articleSignal_${ feed_index }_${ item_index }">
                <li>
                    <a href="#article_${ feed_index }_${ item_index }">${ item['title'] }</a><br/>
                    <#if item['published']?exists > ${ item['published']?datetime?string.short }</#if>
                </li>
            </div>
            </#list>
        </ol>
    </div>
    </#if>
    </#list>
</div>
<mbp:pagebreak />
<div id="content">
    <#list feeds as feed >
    <#if (feed.entryCount > 0) >
    <div id="section_${ feed_index }" class="section">
        <#list feed['entries'] as item >
        <div id="article_${ feed_index }_${ item_index }" class="article">
            <h2 class="do_article_title">
                <#if item['url']?exists >
                <a href="${ item['url'] }">${ item['title'] }</a>
                <#else>
                ${ item['title'] }
                </#if>
            </h2>
            <#if item['published']?exists >${ item['published']?string("yyyy-MM-dd hh:mm:ss a") }</#if>
            <a href="#articleSignal_${ feed_index }_${ item_index }">Return Feed</a>
            <div>${ item['content'] }</div>
            <a href="#articleSignal_${ feed_index }_${ item_index }">Return Feed</a>
        </div>
        </#list>
    </div>
    </#if>
    </#list>
</div>
</body>
</html>